﻿using NHibernate.Mapping.ByCode;
namespace Citi.HeadCount.Domain.Mapping
{
    public class ManagedSegmentMap : EntityMapping<ManagedSegment>
    {
        public ManagedSegmentMap()
        {
            Property(x => x.Code, m => { m.NotNullable(true); });
            Property(x => x.Description, m => { m.NotNullable(true); m.Length(250); });
            Property(x => x.ParentId, m => { m.NotNullable(false); });
            Property(x => x.TreeLevel, m => { m.NotNullable(true); });
            Property(x => x.UpdatedDate, m => { m.NotNullable(true); });
            Property(x => x.Status, m => { m.NotNullable(true); });

            ManyToOne(x => x.Parent, m =>
            {
                m.Column("ParentId");
                m.NotNullable(false);
                m.Insert(false);
                m.Update(false);
            });
        }
    }
}
